<template>
  <div class="tianqi-main">
    <div class="tianqi-zuo">
      <div class="zuo-title tianqi-title">今日天气</div>
      <div class="zuo-content">
        <div class="shang">
          <div class="shangNR">
            <div class="wendu">{{ zuoData.wendu }}<span>ºC</span></div>
            <div class="tianqi">{{ zuoData.tianqiToday }}</div>
          </div>
        </div>
        <div class="xia">{{ zuoData.fengxiang }}</div>
      </div>
    </div>
    <div class="tianqi-you">
      <div class="you-title tianqi-title">近7天天气变化</div>
      <div class="you-content">
        <div class="you-item" v-for="(item,index) in youData" :key="index">
          <div class="you-item-top">{{ item.name }}</div>
          <div class="you-item-bottom">{{ item.value }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { request } from '@/api/request.js'
export default {
  name: 'ViewTianqi',
  data() {
    return {
      zuoData: {},
      youData: []
    }
  },
  mounted() {
    this.getShishi();
  },
  methods: {
    getShishi() {
      request({
        url: '/tianqi',
        method: 'get'
      }).then(res => {
        this.zuoData = res.data.jinri;
        this.youData = res.data.qitian;
      })
    }
  },
  components: {

  }
}
</script>

<style lang="less" scoped>
.tianqi-main {
  width: 100%;
  height: 80%;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;

  .tianqi-title {
    font-family: siyuanFont;
    font-size: 1.4rem;
    color: @mkColor;
    display: flex;
    justify-content: flex-start;
    align-items: center;
  }

  .tianqi-zuo {
    width: 23%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    .zuo-title {
      width: 100%;
      height: 20%;
    }

    .zuo-content {
      width: 100%;
      height: 80%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      .shang {
        width: 100%;
        height: 50%;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        .shangNR{
          width: 100%;
          height: 40%;
          display: flex;
          justify-content: flex-start;
          align-items: flex-end;
          .wendu {
            font-family: shuziFont;
            font-size: 3.6rem;
            color: @leftDataColor;
            span{
              // font-family: shuziFont;
            }
          }
          .tianqi {
            margin-left: 1rem;
            font-size: 2rem;
            padding-bottom: 0.4rem;
          }
        }
      }

      .xia {
        width: 100%;
        height: 50%;
        display: flex;
        color: @mkColor;
        font-family: siyuanFont;
        font-size: 2rem;
        justify-content: center;
        align-items: center;
      }
    }
  }

  .tianqi-you {
    width: 77%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;

    .you-title {
      width: 100%;
      height: 20%;
    }

    .you-content {
      width: 100%;
      height: 80%;
      display: flex;
      justify-content: flex-start;
      align-items: center;
      .you-item{
        width: 13%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        font-family: siyuanFont;
        font-size: 1.6rem;
        color: @mkColor;
        .you-item-top{
          width: 100%;
          height: 40%;
          display: flex;
          justify-content: center;
          align-items: center;
        }
        .you-item-bottom{
          width: 100%;
          height: 60%;
          display: flex;
          justify-content: center;
          align-items: center;
        }
      }
    }
  }
}</style>